package com.lx.redisdemo.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class SessionController {
    @Value("${server.port}")
    private String port;

    public SessionController() {
    }

    @GetMapping({"/session"})
    public Map<String, Object> getSession(HttpServletRequest request) {
        Map<String, Object> map = new HashMap();
        map.put("sessionId", request.getSession().getId());
        map.put("port", this.port);
        return map;
    }
}
